import React, { Component } from 'react'
import TabControl from './TabControl/index'
export default class App extends Component {
  constructor() {
    super()
    this.state = {
      title: ['留学', '看书', '得到'],
      tabIndex: 0
    }
  }
  changeTabIndex(index) {
    this.setState({
      tabIndex:index
    })
  }
  render() {
    const { title, tabIndex } = this.state
    return (
      <div className='app'>
        <TabControl title={title} tabClick={(index) => this.changeTabIndex(index)} />
        <h1 >{title[tabIndex]}</h1>
      </div>
    )
  }
}
